Popover: focus management for dialog role - #34413
Conversation
…ontent_reading' into dmlvr-feature/26_2_popover_support_content_reading
0e86e91 to
8010fa2
Compare
7242766 to
a17511a
Compare
55c6f73 to
d7d5b55
Compare
d7d5b55 to
5f6187d
Compare
42cfdc2 to
5953dba
Compare
d6ab547 to
be5e944
Compare
88ad727 to
42151cd
Compare
| if (!$first) { | ||
| // @ts-expect-error is should can get function as callback | ||
| const isCurrentTabbable = $currentElement?.is(selectors.tabbable); | ||
| const isCurrentNotOverlay = $currentElement?.get(0) !== this._$content?.get(0); |
There was a problem hiding this comment.
Can we include overlay selector in the previous one:
$currentElement
.is(selectors.tabbable)
.not(overlayId);
?
| if (!$last) { | ||
| // @ts-expect-error is should can get function as callback | ||
| const isReverseTabbable = $reverseElement?.is(selectors.tabbable); | ||
| const isReverseNotOverlay = $reverseElement?.get(0) !== this._$content?.get(0); |
There was a problem hiding this comment.
The same comment about selector
| } | ||
|
|
||
| _restoreTargetFocus(): void { | ||
| const $targets = this._getAriaDescriptionTargets(); |
There was a problem hiding this comment.
We can have only one target. We can apply changes from this comment.
| } | ||
| } | ||
|
|
||
| _forceFocusLost(): void { |
There was a problem hiding this comment.
Please check base method. May we can move there this logic.
Also please check what exactly base method do and why.
There was a problem hiding this comment.
Please check base method. Also please check what exactly base method do and why.
The base Overlay._forceFocusLost() checks if the currently focused element is inside the overlay content (this._$content) and blurs (resets) it if so. This prevents focus from being trapped on hidden/invisible elements when the overlay closes, which would break keyboard navigation.
May we can move there this logic?
No. The base Overlay class lacks the role-awareness (_getEffectiveAriaRole()) and target resolution mechanics (_getAriaDescriptionTargets()) that Popover uses to identify and refocus its trigger element.
| @@ -890,6 +938,10 @@ class Popover< | |||
| } | |||
|
|
|||
| _dispose(): void { | |||
| const { visible } = this.option(); | |||
| if (visible && this._getEffectiveAriaRole() === 'dialog') { | |||
| this._restoreTargetFocus(); | |||
There was a problem hiding this comment.
Should we check if we have focus inside?
| @@ -111,6 +111,8 @@ export interface PopoverProperties extends Omit<Properties, | |||
| _overlayContentRole?: string; | |||
|
|
|||
| _describeTarget?: boolean; | |||
|
|
|||
| _preventDialogFocus?: boolean; | |||
There was a problem hiding this comment.
How about _preventDialogContainerFocus?
…r-feature/26_2_popover_support_content_reading Signed-off-by: Dmitry Lavrinovich <52966626+dmlvr@users.noreply.github.com>
…github.com:dmlvr/DevExtreme into dmlvr-feature/26_2_popover_support_content_reading
8e0f3d5
into
DevExpress:feature/26_2_popover_support_content_reading
No description provided.